<h1><%= pluralize(@country.entities.count, "object")%> from <%= @country.name %></h1>

<% if @country.entities.count <= 3 %>
	
	<ul>
		<% @country.entities.each do |entity| %><%= list_link_to(entity.name, museum_object_path(@museum, entity))%><% end %>
	</ul>
	
<% else %>

<% @top_object_types = ObjectType.find_by_sql(["SELECT object_types.id, object_types.name, count(entities.id) as 'count' FROM `categorisations` LEFT JOIN entities ON categorisations.entity_id = entities.id LEFT JOIN object_types ON categorisations.object_type_id = object_types.id WHERE entities.museum_id = ? AND entities.country_id = ? GROUP BY categorisations.object_type_id ORDER BY count DESC LIMIT 0,8;", @museum.id, @country.id]) %>

<p>Including...</p>
<ul>
<% @top_object_types.each do |object_type| %>
	<li><%= pluralize(object_type.count, object_type.name) %></li>
<% end %>
</ul>

<% end%>